<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.util.*,java.text.*,com.adSSO.*,org.apache.commons.logging.*"%> 
<%
	Log log = LogFactory.getLog("jsp");

  	String strAddr = request.getServerName();
	int    strPort = request.getServerPort(); 
	String context = request.getContextPath();
	
	context = "/xplatform"; 
	
	//String strSessionI = request.getParameter("strId");
	//String strSessionK = request.getParameter("strSSKey");
	
	String strSessionI = "TestAdmin";
	String strSessionK = "TestAdmin0001";
	
	String strUrl = null;
	       strUrl = "http://" + strAddr + ":" + Integer.toString(strPort) + context;
	

	if (log.isDebugEnabled()) {
		log.debug("call adCrypto");
	}
	
    adCrypto adc = new adCrypto();
    String sessionKey = adc.generateUUID() ;
    String sTime = adc.GetTime() ;
    String sHash =  adc.hash(sTime,sessionKey);
    session.setAttribute( "sessionHash", sHash );

	//String param = request.getQueryString();
	
	
	
	if (log.isDebugEnabled()) {
	    
	    log.debug("sessionKey="+sessionKey);
	    log.debug("sTime="+sTime);
	    log.debug("sHash="+sHash);
	    
	}
    
%>

<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>KAERI Install Page</TITLE>
<script language="javascript" src="/RexServer30/rexscript/rexpert.js"></script>
<script language="javascript" src="/RexServer30/rexscript/rexpert_properties.js"></script>
<SCRIPT LANGUAGE="javascript">
var Server_Path = "<%=strUrl%>";
//var adlFile = "/project.xadl";

var adlFile = "/project_0406.xadl";
var sKey = "KAERI";

var bOnError = false;
var XPLATFORM_CAB_VER = "2012,5,22,1";

function fn_load() 
{
  if(bOnError == false) 
	{
	  fn_launch();
		setInterval("fn_close()", 3000);
	}
}

function fn_close() {
	
	//return;
	
	if ( /MSIE/.test(navigator.userAgent) ) 
	{
	    if ( navigator.appVersion.indexOf("MSIE 7.0") >= 0 || navigator.appVersion.indexOf("MSIE 8.0") >= 0) 
	    {
			  window.open('about:blank','_self').close();
	    } else {
			  window.opener = self;
			  self.close();
	    } 
	}
}

function fn_objectOnError() 
{
	bOnError = true;
}

function fn_launch() 
{
	XPLauncher.errorfile = Server_Path + "/install/errordefine.xml";
	XPLauncher.splashimage = Server_Path + "/install/img/loading.gif";
	XPLauncher.xadl = Server_Path + adlFile;
	XPLauncher.loadingimage = Server_Path + "/install/img/loading.gif";
	XPLauncher.globalvalue = "gv_SessionI:g=<%=strSessionI%>,gv_SessionK:g=<%=strSessionK%>";
//	XPLauncher.onlyone = true; // 다중인스턴스 실행여부
	XPLauncher.onlyone = false;
//	XPLauncher.makeshortcut("KAERI",Server_Path + "/install/img/KAERI.ico","desktop");
	XPLauncher.makeshortcut("KAERI_MIS",Server_Path + "/install/img/KAERI.ico","desktop");
	XPLauncher.launch();
}

</SCRIPT>
</HEAD>
<BODY onload="fn_load()">
<SCRIPT LANGUAGE="JavaScript">

document.write('<OBJECT ID="adSSOctl" WIDTH="0" HEIGHT="0" '
				+' CLASSID="clsid:E2EFE3B2-10D3-49A0-A5A6-0380358542ED" '
				+' codebase="/adsso/adSSO.cab#version=1,5,0,1">'
				+ ' <PARAM NAME="adDomainName"    VALUE="Kaeri">'
				+ ' <PARAM NAME="adTimeStamp"     VALUE="<%=sTime%>" >'  
				+ ' <PARAM NAME="adSessionKey"    VALUE="<%=sessionKey%>" >' 
				+' </OBJECT>');
//var foobar = adSSOctl.GetadSessionHash();

rex_writeRexCtl('RexCtl', 0, 0);
var sVer = RexCtl.GetVersion();

//XPLATFORM Engin
document.write('<OBJECT ID="XPlatformAXCtrl" CLASSID="CLSID:FCB889AC-D683-47a0-B04C-8FC42E257E5B" width="0" height="0" '
		     + 'CodeBase=/xplatform/install/download/XPLATFORM9.1_SetupEngine.cab#VERSION='+XPLATFORM_CAB_VER+'" onError="fn_objectOnError()">'
			   + '</OBJECT>');

//XPLATFORM Launcher
document.write('<OBJECT ID="XPLauncher" CLASSID="CLSID:3371DC5B-9C2F-4d01-AA1D-E7D62B217697" width="0" height="0" '
		     + 'Codebase=/xplatform/install/download/XPLATFORM9.1_XPLauncher.cab#VERSION='+XPLATFORM_CAB_VER+'" onError="fn_objectOnError()">'
			   + '<PARAM NAME="key" VALUE="' + sKey + '">'
			   + '</OBJECT>');
			   
	   

//XChart 
/*
document.write('<OBJECT ID="XChart" CLASSID="CLSID:e9df30ca-4b30-4235-bf0c-7150f646606c" width="0" height="0" '
         + 'CodeBase=/xplatform/install/download/XChart.cab#version=6,2,2532,19852" >'
         + '</OBJECT>');
*/		 
  
//Ubi Report
/*
document.write('<OBJECT ID="UbiViewerXUni" CLASSID="CLSID:256887A3-916F-4C82-86B3-F432BA83097B" width="0" height="0" '
		     + 'Codebase=/xplatform/install/download/UbiViewerXUni.cab#VERSION=2,502,1104,101>'
			   + '</OBJECT>');
*/			 
 
</SCRIPT>
<table align="center" border=0 width="600"><tr><td><img src="/xplatform/install/img/program.png"></td></tr></table>
</BODY>
</HTML>